<include file="public@header"/>
</head>
<style>
    .form-search label{width:300px;}
    .form-search label.date{width:300px;}
    .form-search input.js-date{width:80px;}
    .form-search select{width:auto !important;}
    .groups{overflow:hidden; width:46%; border-right:1px double #0b7ebf; float:left; margin-bottom:50px; padding:4%;}
    .groups1{overflow:hidden; width:45%; float:left}
    .control-group{/*width:95%; margin:5px 5% 5px 0; overflow:hidden; border-bottom:1px dashed #eee */}
    .control-group1{width:90%; margin:10px 5%; overflow:hidden; border-bottom:1px dashed #eee}
    .control-group label{ width:50%; float:left}
    .control-group1 label{ width:100%; float:left}
    .form-horizontal .control-group1 {
        float: left;
        width: 25%;
        margin-bottom: 20px;
    }
    .form-horizontal .control-label {width:100px;}
    .form-horizontal .controls {margin-left:110px;}

</style>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('orders/visua')}">{:lang('可视化墓区')}</a></li>
        <li><a href="{:url('deposit/tomb_deposit')}?order_id={$order_id}">格位信息</a></li>
        <li><a href="{:url('deposit/deposit_applyer')}?order_id={$order_id}">寄存人信息</a></li>
        <li class="active"><a href="">逝者信息</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form" action="{:url('deposit_user')}" method="post">
        <input type="hidden" name="tomb_id" value="{$tomb_id}">
        <input type="hidden" name="order_id" value="{$order_id}">
        <input type="hidden" name="tomb_num" value="{$tomb_num}">
        <input type="hidden" name="customer_id" value="{$customer_id}">
        <input type="hidden" name="deceased_id" value="{$result_list.deceased_id|default=''}">
        <fieldset>
            <div class="form-group">
                <label class=" control-label"><span class="form-required">*</span>逝者姓名</label>
                <div class="col-lg-2">
                    <input type="text" name="deceased_name" class="disabled form-control" value="{$result_list.deceased_name|default=''}" required  >
                </div>
                <label class="control-label"  ><span class="form-required">*</span>性别</label>
                <div class="col-lg-2">
                    <select name="gender" class="   form-control" >
                        <option value="1" {$result_list.gender1|default=''}>男</option>
                        <option value="2" {$result_list.gender2|default=''}>女</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label"><span class="form-required">*</span>生于</label>
                <div class="col-lg-2" style="">
                    <input type="text" class=" form-control js-date" name="date_birth" required value="{$result_list.date_birth|default=''}"  autocomplete="off" >
                </div>
                <label class="control-label"><span class="form-required">*</span>卒于</label>
                <div class="col-lg-2" style="">
                    <input type="text" class="  form-control js-date" name="date_death" required  value="{$result_list.date_death|default=''}"  autocomplete="off">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label"><span class="form-required">*</span>与寄存者关系</label>
                <div class="col-lg-2" style="">
                    <input type="text" class=" form-control" name="relationship_users" required value="{$result_list.relationship_users|default=''}"  >
                </div>
                <label class="control-label"><span class="form-required">*</span>收敛形式</label>
                <div class="col-lg-2" >
                    <select name="convergence_type" class="form-control">
                        <if condition=" isset($result_list['convergence_type'])">
                            <option value="1" <if condition=" $result_list['convergence_type'] eq 1"> selected </if>>骨灰</option>
                            <option value="2" <if condition=" $result_list['convergence_type'] eq 2"> selected </if>>骨殖</option>
                            <else/>
                            <option value="1">骨灰</option>
                            <option value="2">骨殖</option>
                        </if>
                    </select>
                </div>
            </div>

            <div class="control-group1" style="width: 100%">
                <label class="control-label"><span class="form-required">*</span>火化证明</label>
                <div class="controls">
                    <input type="hidden" name="cremation_certificate_file_id" id="thumb-file_id" value="">
                    <input type="hidden" name="cremation_certificate" id="thumb" value="{$result_list.cremation_certificate|default=''}">
                    <a href="javascript:gpyUploadOneImage('图片上传','#thumb','{$tomb_num}');">
                        <h5 class="btn btn-primary">上传证明文件</h5>
                    </a>
                    <img src="{$result_list.cremation_certificates|default=''}" onclick="parent.imagePreviewDialog(this.src);"  id="thumb-preview" width="36" style="cursor: hand"/>
                </div>
            </div>
        </fieldset>
        <div class="form-actions">
            <button type="submit" id="save" class="btn btn-primary js-ajax-submit">下一步</button>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>

<script type="text/javascript">

    $("#next").click(function () {
        var flag = $('#flag input:radio:checked').val();
        var deceased_name = $('input[name="deceased_name"]').val();
        var order_id = $('input[name="order_id"]').val();
        console.log(flag==0)
        console.log(!deceased_name)
        console.log(flag == 0  && !deceased_name )
        if (flag == 0  && !deceased_name ) {
            alert("请填写使用人！")
        }else if(flag == 1) {
            $(this).prop({href: "{:url('chooseGoods')}?is_shouxue=1&order_id="+order_id});
        }
    });



    // 提交订单
    $("#check-btn").click(function () {
        $.post($("form").attr('action'), $("form").serialize(), function (result) {
            if (result.state == 'success') {
                alert("保存成功！");
                $('#js-dialog-close').click();
            } else {
                alert(result.info);
            }
        }, 'json');
    });
    var num = 2;
    $("select[name='cate']").change(function () {
        var pnum = $("select[name='cate']").val();
        if (pnum == 1) {
            $("#new_user").html('');
        }
        num = pnum;
    })

    $('#add_user').click(function () {
        var i= $(this).attr('data-i');
        console.log(i)
        $(this).attr('data-i',parseInt(i)+1)
        $('#now_user_'+i).css("display","block").find('.disabled').attr('disabled',false)
    })
    // 删除使用人
    $(document).on("click", "[name='del_user']", function () {
        $(this).parents("div[name='now_user']").remove();
    })
</script>

</body>
</html>